/*
paper:

"Testing the differentiated impact of the COVID-19 pandemic
on air travel demand according to social inclusion"

-------
Table 3
-------

data set cae_2105_socinclcov_share_table_3.dta

to run this command, you must install the following stata modules:

xtivreg2
ssc install xtivreg2

esttab
ssc install estout

pdslasso
ssc install pdslasso

*/

*open base
use cae_2105_socinclcov_share_table_3, clear

est clear

*--------------------------------------------------------------------------------------------------------------
*table 3 - column 1
*--------------------------------------------------------------------------------------------------------------
ivlasso PAXVAR INCPRE DENSPRE LEISPRE DIST_* ESSENTNET ESSENTNET_AMAZ (ctr_region_*) ///
	(PVAR COVID = iv_pvar_3_lnv* iv_pvar_3_lnp18 iv_cov_1_* iv_cov_3_* iv_pvar_1_* iv_pvar_2_*  ///
	iv_cov_2_*), cluster(co)

bs, reps(2000) strata(co): ///
	ivreg2 PAXVAR INCPRE DENSPRE LEISPRE DIST_* ESSENTNET ESSENTNET_AMAZ (PVAR COVID =  ///
	iv_pvar_3_lnv1918 iv_cov_3_40 iv_cov_3_13 iv_pvar_2_4 iv_pvar_2_18 iv_pvar_2_34  ///
	iv_cov_2_lnmetempmea_d iv_cov_2_lnsdtempmea_o) ctr_region_1 ctr_region_2 ctr_region_3  ///
	ctr_region_4 ctr_region_5, rob ///
//*
est store col1	
	
*--------------------------------------------------------------------------------------------------------------
*table 3 - column 2
*--------------------------------------------------------------------------------------------------------------
ivlasso PAXVAR INCPRE DENSPRE LEISPRE DIST_* ESSENTNET ESSENTNET_AMAZ (COVID_DIST ctr_region_*)  ///
	(PVAR COVID = iv_pvar_3_lnv* iv_pvar_3_lnp18 iv_cov_1_* iv_cov_3_* iv_pvar_1_* iv_pvar_2_*), cluster(co)

bs, reps(2000) strata(co): ///
	ivreg2 PAXVAR INCPRE DENSPRE LEISPRE DIST_* ESSENTNET ESSENTNET_AMAZ (PVAR COVID =  ///
	iv_pvar_3_lnv1918 iv_pvar_3_lnp18 iv_cov_1_12 iv_cov_3_8 iv_cov_3_42 iv_cov_3_13 iv_pvar_2_15  ///
	iv_pvar_2_18 iv_pvar_2_27 iv_pvar_2_34 iv_pvar_2_39) COVID_DIST ctr_region_1 ctr_region_2  ///
	ctr_region_3 ctr_region_4 ctr_region_5, rob ///
//*
est store col2

*--------------------------------------------------------------------------------------------------------------
*table 3 - column 3
*--------------------------------------------------------------------------------------------------------------
ivlasso PAXVAR INCPRE DENSPRE LEISPRE DIST_* ESSENTNET ESSENTNET_AMAZ (COVID_DIST  ///
	COVID_EMERGAID ctr_region_*) (PVAR COVID = iv_pvar_3_lnv* iv_pvar_3_lnp18 iv_cov_1_*  ///
	iv_cov_3_* iv_pvar_1_* iv_pvar_2_* iv_cov_2_*), cluster(co)

bs, reps(2000) strata(co): ///
	ivreg2 PAXVAR INCPRE DENSPRE LEISPRE DIST_* ESSENTNET ESSENTNET_AMAZ (PVAR COVID =  ///
	iv_pvar_3_lnv1918 iv_pvar_3_lnp18 iv_cov_1_11 iv_cov_3_8 iv_cov_3_42 iv_cov_3_13  ///
	iv_pvar_1_2 iv_pvar_2_5 iv_pvar_2_14 iv_pvar_2_20 iv_pvar_2_22 iv_pvar_2_24  ///
	iv_pvar_2_32 iv_pvar_2_34 iv_pvar_2_45 iv_cov_2_lnmetempmea_d iv_cov_2_lnsdtempmea_o)  ///
	COVID_DIST COVID_EMERGAID ctr_region_1 ctr_region_2 ctr_region_3 ctr_region_4 ctr_region_5, rob ///
//*
est store col3
	
*--------------------------------------------------------------------------------------------------------------
*table 3 - column 4
*--------------------------------------------------------------------------------------------------------------
ivlasso PAXVAR INCPRE DENSPRE LEISPRE DIST_* ESSENTNET ESSENTNET_AMAZ (COVID_DIST  ///
	COVID_EMERGAID COVID_SOCINCL ctr_region_*) (PVAR COVID = iv_pvar_3_lnv*  ///
	iv_pvar_3_lnp18 iv_cov_1_* iv_cov_3_* iv_pvar_1_* iv_pvar_2_* iv_cov_2_*), cluster(co)

bs, reps(2000) strata(co): ///
	ivreg2 PAXVAR INCPRE DENSPRE LEISPRE DIST_* ESSENTNET ESSENTNET_AMAZ (PVAR COVID =  ///
	iv_pvar_3_lnv1918 iv_pvar_3_lnp18 iv_cov_1_11 iv_cov_3_8 iv_cov_3_42 iv_cov_3_13  ///
	iv_pvar_1_2 iv_pvar_2_5 iv_pvar_2_14 iv_pvar_2_20 iv_pvar_2_22 iv_pvar_2_24 iv_pvar_2_32  ///
	iv_pvar_2_34 iv_pvar_2_45 iv_cov_2_lnmetempmea_d iv_cov_2_lnsdtempmea_o) COVID_DIST  ///
	COVID_EMERGAID COVID_SOCINCL ctr_region_1 ctr_region_2 ctr_region_3 ctr_region_4 ctr_region_5, rob ///
//*
est store col4

*--------------------------------------------------------------------------------------------------------------
*table 3 - column 5
*--------------------------------------------------------------------------------------------------------------
ivlasso PAXVAR INCPRE DENSPRE LEISPRE DIST_* ESSENTNET ESSENTNET_AMAZ (COVID_DIST  ///
	COVID_EMERGAID COVID_SOCINCL ctr_region_*) (PVAR COVID CODESHARE = iv_pvar_3_lnv*  ///
	iv_pvar_3_lnp18 iv_cov_1_* iv_cov_3_* iv_pvar_1_* iv_pvar_2_* iv_cov_2_*), cluster(co)

bs, reps(2000) strata(co): ///
	ivreg2 PAXVAR INCPRE DENSPRE LEISPRE DIST_* ESSENTNET ESSENTNET_AMAZ (PVAR COVID  ///
	CODESHARE = iv_pvar_3_lnv1918 iv_pvar_3_lnp18 iv_cov_1_11 iv_cov_3_8 iv_cov_3_42  ///
	iv_cov_3_13 iv_pvar_1_2 iv_pvar_2_5 iv_pvar_2_14 iv_pvar_2_20 iv_pvar_2_22 iv_pvar_2_24  ///
	iv_pvar_2_32 iv_pvar_2_34 iv_pvar_2_45 iv_cov_2_lnmetempmea_d iv_cov_2_lnsdtempmea_o)  ///
	COVID_DIST COVID_EMERGAID COVID_SOCINCL ctr_region_1 ctr_region_2 ctr_region_3  ///
	ctr_region_4 ctr_region_5, rob ///
//*
est store col5

*--------------------------------------------------------------------------------------------------------------
*table 3 - column 6
*--------------------------------------------------------------------------------------------------------------
ivlasso PAXVAR INCPRE DENSPRE LEISPRE DIST_* ESSENTNET ESSENTNET_AMAZ (COVID_DIST  ///
	COVID_EMERGAID COVID_SOCINCL ctr_region_* intctr_reg_*) (PVAR COVID CODESHARE =  ///
	iv_pvar_3_lnv* iv_pvar_3_lnp18 iv_cov_1_* iv_cov_3_* iv_pvar_1_* iv_pvar_2_*  ///
	iv_cov_2_*), cluster(co)

bs, reps(2000) strata(co): ///
	ivreg2 PAXVAR INCPRE DENSPRE LEISPRE DIST_* ESSENTNET ESSENTNET_AMAZ (PVAR COVID  ///
	CODESHARE = iv_pvar_3_lnp18 iv_cov_3_40 iv_cov_3_10 iv_cov_3_11 iv_cov_3_12 iv_cov_3_13  ///
	iv_pvar_2_22 iv_pvar_2_46 iv_cov_2_lnmetempmea_d) COVID_DIST COVID_EMERGAID COVID_SOCINCL  ///
	ctr_region_1 ctr_region_2 ctr_region_3 ctr_region_5 intctr_reg_GP3 intctr_reg_GP4  ///
	intctr_reg_GP5 intctr_reg_GP6 intctr_reg_GP8 intctr_reg_GP9 intctr_reg_GP11 intctr_reg_GP12  ///
	intctr_reg_GP13 intctr_reg_GP14 intctr_reg_GP17 intctr_reg_GP18 intctr_reg_GP19  ///
	intctr_reg_R2 intctr_reg_R5 intctr_reg_R8 intctr_reg_R15 intctr_reg_R17 intctr_reg_R22  ///
	intctr_reg_F3 intctr_reg_F4 intctr_reg_F5 intctr_reg_F9 intctr_reg_F12 intctr_reg_F13  ///
	intctr_reg_F19 intctr_reg_F22, rob ///
	partial ( ctr_region_1 ctr_region_2 ctr_region_3 ctr_region_5 intctr_reg_GP3 intctr_reg_GP4  ///
	intctr_reg_GP5 intctr_reg_GP6 intctr_reg_GP8 intctr_reg_GP9 intctr_reg_GP11 intctr_reg_GP12  ///
	intctr_reg_GP13 intctr_reg_GP14 intctr_reg_GP17 intctr_reg_GP18 intctr_reg_GP19  ///
	intctr_reg_R2 intctr_reg_R5 intctr_reg_R8 intctr_reg_R15 intctr_reg_R17 intctr_reg_R22  ///
	intctr_reg_F3 intctr_reg_F4 intctr_reg_F5 intctr_reg_F9 intctr_reg_F12 intctr_reg_F13  ///
	intctr_reg_F19 intctr_reg_F22 ///
	) ///
//*
est store col6

*--------------------------------------------------------------------------------------------------------------
*table 3 - column 7
*--------------------------------------------------------------------------------------------------------------
ivlasso PAXVAR INCPRE DENSPRE LEISPRE DIST_* ESSENTNET ESSENTNET_AMAZ (COVIDalt_DIST  ///
	COVIDalt_EMERGAID COVIDalt_SOCINCL ctr_region_* intctr_reg_*) (PVAR COVIDalt CODESHARE =  ///
	iv_pvar_3_lnv* iv_pvar_3_lnp18 iv_cov_1_* iv_cov_3_* iv_pvar_1_* iv_pvar_2_*  ///
	iv_cov_2_*), cluster(co)

bs, reps(2000) strata(co): ///
	ivreg2 PAXVAR INCPRE DENSPRE LEISPRE DIST_* ESSENTNET ESSENTNET_AMAZ (PVAR COVIDalt  ///
	CODESHARE = iv_pvar_3_lnp18 iv_cov_1_9 iv_cov_1_10 iv_cov_3_40 iv_cov_3_10 iv_cov_3_12  ///
	iv_pvar_2_46) COVIDalt_DIST COVIDalt_EMERGAID COVIDalt_SOCINCL ctr_region_1 ctr_region_2 ctr_region_3  ///
	ctr_region_5 intctr_reg_GP3 intctr_reg_GP5 intctr_reg_GP6 intctr_reg_GP8 intctr_reg_GP9  ///
	intctr_reg_GP11 intctr_reg_GP13 intctr_reg_GP14 intctr_reg_GP17 intctr_reg_R2 intctr_reg_R15  ///
	intctr_reg_R22 intctr_reg_R23 intctr_reg_F1 intctr_reg_F3 intctr_reg_F4 intctr_reg_F5  ///
	intctr_reg_F12 intctr_reg_F13 intctr_reg_F22, rob ///
	partial ( ctr_region_1 ctr_region_2 ctr_region_3  ///
	ctr_region_5 intctr_reg_GP3 intctr_reg_GP5 intctr_reg_GP6 intctr_reg_GP8 intctr_reg_GP9  ///
	intctr_reg_GP11 intctr_reg_GP13 intctr_reg_GP14 intctr_reg_GP17 intctr_reg_R2 intctr_reg_R15  ///
	intctr_reg_R22 intctr_reg_R23 intctr_reg_F1 intctr_reg_F3 intctr_reg_F4 intctr_reg_F5  ///
	intctr_reg_F12 intctr_reg_F13 intctr_reg_F22 ///
	) ///
//*
est store col7	

*--------------------------------------------------------------------------------------------------------------
*table 3 - column 8
*--------------------------------------------------------------------------------------------------------------
ivlasso PAXVAR INCPRE DENSPRE LEISPRE DIST_* ESSENTNET ESSENTNET_AMAZ (COVID_DIST  ///
	COVID_EMERGAID COVID_SOCINCLalt ctr_region_* intctr_reg_*) (PVAR COVID CODESHARE =  ///
	iv_pvar_3_lnv* iv_pvar_3_lnp18 iv_cov_1_* iv_cov_3_* iv_pvar_1_* iv_pvar_2_*  ///
	iv_cov_2_*), cluster(co)

bs, reps(2000) strata(co): ///
	ivreg2 PAXVAR INCPRE DENSPRE LEISPRE DIST_* ESSENTNET ESSENTNET_AMAZ (PVAR COVID  ///
	CODESHARE = iv_pvar_3_lnp18 iv_cov_3_40 iv_cov_3_10 iv_cov_3_11 iv_cov_3_12 iv_cov_3_13  ///
	iv_pvar_2_22 iv_pvar_2_46 iv_cov_2_lnmetempmea_d) COVID_DIST COVID_EMERGAID COVID_SOCINCLalt  ///
	ctr_region_1 ctr_region_2 ctr_region_3 ctr_region_5 intctr_reg_GP3 intctr_reg_GP4  ///
	intctr_reg_GP5 intctr_reg_GP6 intctr_reg_GP8 intctr_reg_GP9 intctr_reg_GP11 intctr_reg_GP12  ///
	intctr_reg_GP13 intctr_reg_GP14 intctr_reg_GP17 intctr_reg_GP18 intctr_reg_R2 intctr_reg_R5  ///
	intctr_reg_R8 intctr_reg_R15 intctr_reg_R17 intctr_reg_R22 intctr_reg_F1 intctr_reg_F3  ///
	intctr_reg_F4 intctr_reg_F5 intctr_reg_F12 intctr_reg_F13 intctr_reg_F19 intctr_reg_F22, rob ///
	partial ( ctr_region_1 ctr_region_2 ctr_region_3 ctr_region_5 intctr_reg_GP3 intctr_reg_GP4  ///
	intctr_reg_GP5 intctr_reg_GP6 intctr_reg_GP8 intctr_reg_GP9 intctr_reg_GP11 intctr_reg_GP12  ///
	intctr_reg_GP13 intctr_reg_GP14 intctr_reg_GP17 intctr_reg_GP18 intctr_reg_R2 intctr_reg_R5  ///
	intctr_reg_R8 intctr_reg_R15 intctr_reg_R17 intctr_reg_R22 intctr_reg_F1 intctr_reg_F3  ///
	intctr_reg_F4 intctr_reg_F5 intctr_reg_F12 intctr_reg_F13 intctr_reg_F19 intctr_reg_F22 ///
	) ///
//*
est store col8

*--------------------------------------------------------------------------------------------------------------
*table 3 - column 9
*--------------------------------------------------------------------------------------------------------------
ivlasso PAXVAR INCPREalt DENSPREalt LEISPRE DIST_* ESSENTNET ESSENTNET_AMAZ (COVIDalt_DIST  ///
	COVIDalt_EMERGAID COVIDalt_SOCINCLalt ctr_region_* intctr_reg_*) (PVAR COVIDalt CODESHARE =  ///
	iv_pvar_3_lnv* iv_pvar_3_lnp18 iv_cov_1_* iv_cov_3_* iv_pvar_1_* iv_pvar_2_*  ///
	iv_cov_2_*), cluster(co)

bs, reps(2000) strata(co): ///
	ivreg2 PAXVAR INCPREalt DENSPREalt LEISPRE DIST_* ESSENTNET ESSENTNET_AMAZ (PVAR COVIDalt ///
	CODESHARE = iv_pvar_3_lnp18 iv_cov_1_9 iv_cov_1_10 iv_cov_3_40 iv_cov_3_10 iv_cov_3_12 ///
	iv_pvar_2_46) COVIDalt_DIST COVIDalt_EMERGAID COVIDalt_SOCINCLalt ctr_region_1 ctr_region_2 ///
	ctr_region_3 intctr_reg_GP3 intctr_reg_GP5 intctr_reg_GP6 intctr_reg_GP8 intctr_reg_GP9 ///
	intctr_reg_GP11 intctr_reg_GP13 intctr_reg_GP14 intctr_reg_GP17 intctr_reg_R2 intctr_reg_R15 ///
	intctr_reg_R16 intctr_reg_R22 intctr_reg_R23 intctr_reg_F1 intctr_reg_F3 intctr_reg_F4 ///
	intctr_reg_F12 intctr_reg_F13 intctr_reg_F16 intctr_reg_F22, rob ///
	partial(ctr_region_1 ctr_region_2 ctr_region_3 intctr_reg_GP3 intctr_reg_GP5 intctr_reg_GP6 ///
	intctr_reg_GP8 intctr_reg_GP9 intctr_reg_GP11 intctr_reg_GP13 intctr_reg_GP14 intctr_reg_GP17 ///
	intctr_reg_R2 intctr_reg_R15 intctr_reg_R16 intctr_reg_R22 intctr_reg_R23 intctr_reg_F1 ///
	intctr_reg_F3 intctr_reg_F4 intctr_reg_F12 intctr_reg_F13 intctr_reg_F16 intctr_reg_F22)
	) ///
//*

est store col9

*--------------------------------------------------------------------------------------------------------------
*display table 3
*--------------------------------------------------------------------------------------------------------------
esttab *, not b(%9.4f) label ///
keep(DIST_* PVAR INCPRE INCPREalt DENSPRE DENSPREalt LEISPRE ESSENTNET ESSENTNET_AMAZ ///
		CODESHARE COVID COVIDalt COVID_DIST COVIDalt_DIST ///
		COVID_EMERGAID COVIDalt_EMERGAID COVID_SOCINCL COVIDalt_SOCINCL COVID_SOCINCLalt COVIDalt_SOCINCLalt) ///
order(DIST_* PVAR INCPRE INCPREalt DENSPRE DENSPREalt LEISPRE ESSENTNET ESSENTNET_AMAZ ///
		CODESHARE COVID COVIDalt COVID_DIST COVIDalt_DIST ///
		COVID_EMERGAID COVIDalt_EMERGAID COVID_SOCINCL COVIDalt_SOCINCL COVID_SOCINCLalt COVIDalt_SOCINCLalt)
*--------------------------------------------------------------------------------------------------------------







